/**
 * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.school.service;

import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.book.entity.BkBookstore;
import com.thinkgem.jeesite.modules.school.dao.SchoolDao;
import com.thinkgem.jeesite.modules.school.entity.School;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 学校Service
 *
 * @author ThinkGem
 * @version 2014-05-16
 */
@Service
@Transactional(readOnly = true)
public class SchoolService extends CrudService<SchoolDao, School>{

    /**
     * 查询教育局监管学校各项信息
     *
     * @return School
     */
    public School getSvSchoolData(){
        //图书
        School school = new School();
        school.setTotalBooks(dao.findSvSchoolBooks());
        school.setTotalReaders(dao.findSvSchoolReaders());
        school.setBorrowedBooks(dao.findBorrowedBooks());
        return school;
    }

    public List<BkBookstore> getBooksAmount(Date begin, Date end, String limit){
        return dao.getBooksAmount(begin, end, limit);
    }

    public List<Map> getBooksZongKuoZhang(){
        return dao.getBooksZongKuoZhang();
    }

    public Long findAllBooksCount(){
        return dao.findAllBooksCount();
    }

    public int findBorrowedBooks(){
        return dao.findBorrowedBooks();
    }

    public int findAllBookTypeAmount(){
        return dao.findAllBookTypeAmount();
    }
}
